﻿using System;
using System.Linq;
using System.Collections.Generic;

namespace Ayatta.Contract.Domain
{
    public class CategoryGroup : IEntity<int>
    {
        public int Id { get; set; }
        public int Group { get; set; }
        public string Name { get; set; }
        public bool Expand { get; set; }
        public string CategoryId { get; set; }
        public int Priority { get; set; }
        public byte Status { get; set; }

        public IList<int> Categories
        {
            get
            {
                var result = new List<int>();
                if (!string.IsNullOrEmpty(CategoryId))
                {
                    var array = CategoryId.Split(',');
                    result.AddRange(array.Select(o => Convert.ToInt32(o)));
                }
                return result;
            }
        }
    }
}